const toString = Object.prototype.toString;

export const is = (val, type) =>
  toString.call(val) === `[object ${type}]`;

export const isUndef = (val)  =>
  typeof val === "undefined";

export const isNull = (val) => val === null;

export const isNullOrUnDef = (val) =>
  isNull(val) || isUndef(val);

export const isObject = (val) =>
  val !== null && is(val, "Object");

export const isArray = (val) => is(val, "Array");

export const isString = (val) => is(val, "String");

export const isDate = (val) => is(val, "Date");

export const isNumber = (val) => is(val, "Number");

export const isFunction = (val) => is(val, "Function");
